package Homework3;

public class SimulThread extends Thread {
	SharedArea sharedArea;

	@Override
	public void run() {
		int sum = 0;
		for (int cnt = 0; cnt < 1000000; cnt++) {
			java.util.Random random = new java.util.Random();
			boolean isHead = random.nextBoolean();
			if (isHead)
				sum++;
		}
		sharedArea.ratio = sum / 1000000.0;
		synchronized (sharedArea) {
			sharedArea.notify();
		}
	}
}
